import {
    Alliance,
    CompanyUsage,
    MediaResourceData,
    TitleBack,
    TypeProportion,
} from "@/type/workBench";
import axios, { Response } from "./axios";
import factorySingleClass from "./SingleClass";

class WorkBenchService {
    typeProportion() {
        return axios.get<Response<TypeProportion[]>>(
            `/mediaresourcelib-datastatistics-service/mediaResource/typeProportion`,
        );
    }
    usage(str: string) {
        return axios.get<Response<CompanyUsage[]>>(
            `/mediaresourcelib-datastatistics-service/mediaResource/usage?type=1&${str}`,
        );
    }
    mediaResourceData(startTime: string, endTime: string) {
        return axios.get<Response<MediaResourceData[]>>(
            `/mediaresourcelib-datastatistics-service/mediaResource/mediaResourceData?startTime=${startTime}&endTime=${endTime}&searchType=1`,
        );
    }

    mediaDataByCompany(startTime: string, endTime: string) {
        return axios.get<Response<MediaResourceData[]>>(
            `/mediaresourcelib-datastatistics-service/mediaResource/mediaDataByCompany?startTime=${startTime}&endTime=${endTime}&searchType=1`,
        );
    }

    titleBack() {
        return axios.get<Response<TitleBack>>(
            `/mediaresourcelib-datastatistics-service/mediaResource/titleBack`,
        );
    }
    getOrgTypeNumbe(
        order = 1,
        allianceId = undefined,
        companyName = undefined,
    ) {
        return axios.get<Response<any>>(
            `/mediaresourcelib-datastatistics-service/mediaResource/getOrgTypeNumber?order=${order}&allianceId=${
                allianceId || ""
            }&companyName=${companyName || ""}`,
        );
    }
    allianceList() {
        return axios.get<Response<Alliance[]>>(
            `/mediaresourcelib-datastatistics-service/mediaResource/allianceList`,
        );
    }
}
export default factorySingleClass(WorkBenchService);
